//
//  TextViewController.m
//  SegmentDemo
//
//  Created by 塔兮 on 2022/4/12.
//

#import "TextViewController.h"

@interface TextViewController ()

@property (nonatomic, strong) SegmentPageView *pageView;

@end

@implementation TextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configureView];
}

- (SegmentPageView *)pageView {
    if (!_pageView) {
        _pageView = [[SegmentPageView alloc]initWithFrame:CGRectMake(0, 20, SCWidth, SCHeight - NavBarAndStatusBarHeight - 20)];
        _pageView.spacing = 20.f;
        _pageView.topRadius = 10.f;
        _pageView.equalWidth = YES;
        _pageView.topWidth = SCWidth - 40;
        _pageView.topBackColor = UIColorFromHex(@"FFFFFF");
        _pageView.segmentType = SegmentTitleType;
        _pageView.backgroundColor = UIColorFromHex(@"F5F5F5");
    }
    return _pageView;
}

- (void)configureView {
    self.title = @"文字";
    [self.view addSubview:self.pageView];
    self.view.backgroundColor = UIColorFromHex(@"F5F5F5");
    NSString *string = @"分";
    NSMutableArray *array = [NSMutableArray new];
    for (int i = 0; i < 3; i++) {
        BaseViewController *base = [BaseViewController new];
        base.title = [NSString stringWithFormat:@"%@",string];
//        base.remindNum = 2;
        base.backColor = UIColorFromHex(@"F5F5F5");
//        __weak __typeof(self) weakSelf = self;
//        base.reloadRemind = ^{
//            [weakSelf.pageView viewControllerRemind];
//        };
        [array addObject:base];
        string = [NSString stringWithFormat:@"%@页",string];
    }
    self.pageView.viewControllers = array;
}

@end
